<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
    <script>
        class HD {
            constructor(...array) {
                this.array = array
            }
            find(value) {
                for (const v of this.array) {
                    if (v == value) return v
                }
            }
            findIndex(value) {
                for (const key in this.array) {
                    if (value == this.array[key]) return key
                }
                return false
            }
            includes(value) {
                for (const v of this.array) {
                    if (v == value) return true
                }
                return false
            }
            map(callback) {
                let array = []
                for (const [key, value] of this.array.entries()) {
                    array.push(callback(value, key, this.array))
                }
                return array
            }
            filter(callback) {
                let array = []
                for (const [key, value] of this.array.entries()) {
                    if (callback(value, key, this.array)) {
                        array.push(value)
                    }
                }
                return array
            }
        }
        const words = new HD('spray', 'limit', 'elite', 'exuberant', 'destruction', 'present');
        const result = words.filter(word => word.length > 6);
        console.log(result)
    </script>
</body>

</html>